$def with (course, tasks, user_data, audiences, tutored_audiences, tutored_users, checked_tasks, checked_users, valid_formats, chosen_format, show_audiences, error)

$#
$# This file is part of INGInious. See the LICENSE and the COPYRIGHTS files for
$# more information about the licensing of this file.
$#

$var title: $:course.get_name(user_manager.session_language()) - $:_("Download submissions")

$var Column: $:template_helper.call('course_admin_menu',course=course,current='download')

$def NavbarF():
    <nav aria-label="breadcrumb">
        <ol class="breadcrumb">
            <li class="breadcrumb-item"><a href="$get_homepath()/course/$course.get_id()">$course.get_name(user_manager.session_language())</a></li>
            <li class="breadcrumb-item"><a href="$get_homepath()/admin/$course.get_id()" title=$:_('"Administration"') data-toggle="tooltip" data-placement="bottom">
                <i class="fa fa-user-secret"></i></a></li>
            <li class="breadcrumb-item active"><a href="#"><i class="fa fa-download"></i> $:_("Download submissions") <span class="sr-only">$:_("(current)")</span></a></li>
        </ol>
    </nav>
$var Navbar: $:NavbarF()

<h2>$:_("Download submissions")</h2>

$if error:
    <div class="alert alert-danger alert-dismissable" role="alert">
        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
        $error
    </div>

<form method="post" action="$get_homepath()/admin/$course.get_id()/download">
    $:include.course_admin.submissions_tabs.tasks(tasks, checked_tasks, "download")
    $:include.course_admin.submissions_tabs.users(user_data, audiences, tutored_audiences, tutored_users, checked_users, show_audiences)

    <div class="card mb-3">
        <div class="card-header">
            $:_("Other options")
        </div>
        <div class="card-body">
            <div class="form-group">
                <label for="folder_format" class="col-sm-2 control-label">$:_("Folder format")</label>
                <div class="col-sm-10">
                    <ul class="list-unstyled">
                        $for entry in valid_formats:
                            <li><label><input type="radio" name="format" value="$entry"
                                              $if chosen_format == entry:
                                                checked="checked"
                                    /> $:_(entry)</label></li>
                    </ul>
                </div>
            </div>
            <div class="form-group">
                <label for="folder_format" class="col-sm-2 control-label">$:_("Type")</label>

                <div class="col-sm-10">
                    <ul class="list-unstyled">
                        <li>
                            <label>
                                <input type="radio" name="type" value="single" checked="checked"/>
                                $:_("Download only the evaluation submission for each task/user")/$(_('audience'))
                            </label>
                        </li>
                        <li>
                            <label>
                                <input type="radio" name="type" value="all"/>
                                $:_("Download all the submissions")
                            </label>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>

    <button type="submit" class="btn btn-default btn-lg btn-block center-block">
        <i class="fa fa-download fa-fw"></i>&nbsp; $:_("Download")
    </button>
</form>